﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Text;
using PdfSharp.Drawing;

namespace VAdvantage.Print
{
    /// <summary>
    /// 2D Dimesnion Implementation
    /// </summary>
    public class Dimension2DImpl
    {
        /// <summary>
        /// Constructor
        /// </summary>
        public Dimension2DImpl()
        {
        }	//	Dimension2DImpl


        public Dimension2DImpl(double Width, double Height)
        {
            SetSize(Width, Height);
        }	//	Dimension2DImpl
        /**	Width			*/
        public double width = 0;
        /**	Height			*/
        public double height = 0;

        public void SetSize(double Width, double Height)
        {
            this.width = Width;
            this.height = Height;
        }	//	setSize


        public void AddBelow(XSize size)
        {
            AddBelow(size.Width, size.Height);
        }

        public void AddBelow(double dWidth, double dHeight)
        {
            if (this.width < dWidth)
                this.width = dWidth;
            this.height += dHeight;
        }	//	addBelow

        public void RoundUp()
        {
            width = Math.Ceiling(width);
            height = Math.Ceiling(height);
        }	//	roundUp

        public double GetWidth()
        {
            return width;
        }	//	getWidth

        public double GetHeight()
        {
            return height;
        }	//	getHeight


        /// <summary>
        /// Hashcode
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }


        /// <summary>
        /// String Representation
        /// </summary>
        /// <returns>Info</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("Dimension2D[w=").Append(width).Append(",h=").Append(height).Append("]");
            return sb.ToString();
        }
    }
}
